#ifndef _PWM_H_
#define _PWM_H_

#include "../device/Device.h"
#include "../counter/Counter.h"


/*
	class : Pwm
	desc : This class implements pulse width modulation
		and sends the output to the bit pointer
*/
class Pwm : public Device
{
	private:
	//counter that determines how many ones to output
	Counter<unsigned char> oneWidth;
	//counter that determines how many zeroes to output
	Counter<unsigned char> zeroWidth;
	//tells the state of the pwm
	unsigned char state;
	//where the data is outputted
	BitPointer out;

	public:
	//default constructor
	Pwm();
	//constructor sets the number of zeroes and ones and sets bit pointer
	Pwm(unsigned char zero, unsigned char one, BitPointer out);
	//sets the how many ones and zeroes to output
	void setWidth(unsigned char zero, unsigned char one);
	//returns the number of zeroes outputted
	unsigned char getZeroWidth();
	//returns the number of ones to output.
	unsigned char getOneWidth();
	//runs the pulse width modulation unit
	void run();

};




#endif

